package com.bbt.dormassistant.controller;


import com.bbt.dormassistant.service.DormitoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;


@Api(tags = "匹配算法接口")
@RestController
@RequestMapping("/dormitory")
public class DormitoryController {


    @Autowired
    private DormitoryService dormitoryService;


    @ApiOperation(value = "获取用户的宿舍匹配情况")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "string")
    })
    @GetMapping("/findByUserId")
    public Map findByUserId(@RequestParam String userId){
        Map<String,Object> map = new HashMap<>();
        map.put("dormitory",dormitoryService.getDormitoryByUserId(userId));
        return map;
    }

}
